package com.shkmall.goods.handle;


import com.shkmall.common.pojo.Result;
import com.shkmall.common.pojo.StatusCode;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice /*声明该类是一个增强类*/
public class ExceptionHandle {

    @ExceptionHandler(value = Exception.class)/*声明该方法是异常处理方法 并制定处理异常的类型*/
    @ResponseBody
    public Result error(Exception e){
        e.printStackTrace();
        return new Result(false, StatusCode.ERROR,"当前系统忙，请稍后重试");
    }
}
